home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection Student Program / ADC Tools Sampler CD Disk 3 1999.iso / Metrowerks CodeWarrior / Java Support / Java_Source / IFC_112 / netscape / util / Decoder.java < prev    next >
Encoding:
Text File  |  1999-05-28  |  4.1 KB  |  111 lines  |  [TEXT/CWIE]

  1. // Decoder.java
  2. // By Ned Etcode
  3. // Copyright 1995, 1996, 1997 Netscape Communications Corp.  All rights reserved.
  4.  
  5. package netscape.util;
  6.  
  7. /** The Decoder interface describes the API through which objects decode
  8.   * their essential state as a set of key-value pairs. Unarchiver implements
  9.   * this API to decode the state of a graph of objects from an Archive.
  10.   * @see Codable
  11.   * @see Encoder
  12.   * @see Unarchiver
  13.   * @see Archive
  14.   */
  15. public interface Decoder {
  16.     /** Returns the version information for the class named <b>className</b>.
  17.       * Objects can use this information to bring forward old encodings at
  18.       * runtime.
  19.       */
  20.     public int versionForClassName(String className) throws CodingException;
  21.  
  22.     /** Decodes the boolean value associated with the string <b>key</b>.
  23.       */
  24.     public boolean decodeBoolean(String key) throws CodingException;
  25.  
  26.     /** Decodes the boolean array associated with the string <b>key</b>.
  27.       */
  28.     public boolean[] decodeBooleanArray(String key) throws CodingException;
  29.  
  30.     /** Decodes the character value associated with the string <b>key</b>.
  31.       */
  32.     public char decodeChar(String key) throws CodingException;
  33.  
  34.     /** Decodes the character array associated with the string <b>key</b>.
  35.       */
  36.     public char[] decodeCharArray(String key) throws CodingException;
  37.  
  38.     /** Decodes the byte value associated with the string <b>key</b>.
  39.       */
  40.     public byte decodeByte(String key) throws CodingException;
  41.  
  42.     /** Decodes the byte array associated with the string <b>key</b>.
  43.       */
  44.     public byte[] decodeByteArray(String key) throws CodingException;
  45.  
  46.     /** Decodes the short value associated with the string <b>key</b>.
  47.       */
  48.     public short decodeShort(String key) throws CodingException;
  49.  
  50.     /** Decodes the short array associated with the string <b>key</b>.
  51.       */
  52.     public short[] decodeShortArray(String key) throws CodingException;
  53.  
  54.     /** Decodes the integer value associated with the string <b>key</b>.
  55.       */
  56.     public int decodeInt(String key) throws CodingException;
  57.  
  58.     /** Decodes the integer array associated with the string <b>key</b>.
  59.       */
  60.     public int[] decodeIntArray(String key) throws CodingException;
  61.  
  62.     /** Decodes the long value associated with the string <b>key</b>.
  63.       */
  64.     public long decodeLong(String key) throws CodingException;
  65.  
  66.     /** Decodes the long array value associated with the string <b>key</b>.
  67.       */
  68.     public long[] decodeLongArray(String key) throws CodingException;
  69.  
  70.     /** Decodes the float value associated with the string <b>key</b>.
  71.       */
  72.     public float decodeFloat(String key) throws CodingException;
  73.  
  74.     /** Decodes the float array associated with the string <b>key</b>.
  75.       */
  76.     public float[] decodeFloatArray(String key) throws CodingException;
  77.  
  78.     /** Decodes the double value associated with the string <b>key</b>.
  79.       */
  80.     public double decodeDouble(String key) throws CodingException;
  81.  
  82.     /** Decodes the double array associated with the string <b>key</b>.
  83.       */
  84.     public double[] decodeDoubleArray(String key) throws CodingException;
  85.  
  86.     /** Decodes the string value associated with the string <b>key</b>.
  87.       */
  88.     public String decodeString(String key) throws CodingException;
  89.  
  90.     /** Decodes the string array associated with the string <b>key</b>.
  91.       */
  92.     public String[] decodeStringArray(String key) throws CodingException;
  93.  
  94.     /** Decodes a reference to another Codable object.
  95.       */
  96.     public Object decodeObject(String key) throws CodingException;
  97.  
  98.     /** Decodes an array of Codable objects. The references to the Codable
  99.       * objects are shared, but the reference to the array is not.
  100.       */
  101.     public Object[] decodeObjectArray(String key) throws CodingException;
  102.  
  103.     /** Replaces references to the object currently being decoded with
  104.       * <b>replacement</b>. This method throws a CodingException when an
  105.       * attempt is made to replace an object which has already been seen
  106.       * by other objects. For maximum safety, this method should only be
  107.       * called from leaves of the object graph.
  108.       */
  109.     public void replaceObject(Object replacement) throws CodingException;
  110. }
  111.